/*
 * @Author: ChunLai
 * @Date: 2023-07-25 09:48:14
 * @LastEditTime: 2023-08-04 19:03:51
 * @Description:
 * @FilePath: \0.newInsure\src\translate\Insert\index.js
 */
import { setMessage, getMessage } from '@/methods/cache.js';
import store from '../../store';
import request from '@/utils/request.js';
import { GetRiskData } from '@/translate/risks/insert.js';
// import {
//   searchDingDanDetail
// } from "@/apifunctions/bill.js"

// 东吴税收声明字段赋值
function setTaskInfo(item, type = 'tbr') {
  let obj = {
    crsIdType: item.crsIdType,
    crsIdTypeName: item.crsIdTypeName || '',
    homeAddressCHN: item.homeAddressCHN,
    homeAddressEN: item.homeAddressEN,
    placeOfBirthCHN: item.placeOfBirthCHN,
    placeOfBirthEN: item.placeOfBirthEN,
    taxCountyAndNos: item.taxCountyAndNos
      ? item.taxCountyAndNos.split(',')[0]
      : '',
    taxNum2: item.taxNum2 || '',
    taxNum3: item.taxNum3 || '',
    noTaxNoReasonDetail: item.noTaxNoReasonDetail,
    noTaxNoReason: item.noTaxNoReason,
  };
  if (type === 'tbr') {
    setMessage('tbTaxFile', obj);
  } else {
    setMessage('bbTaxFile', obj);
  }
}
// 税收声明字段赋值
function setTaskInfo2(item, type = 'tbr') {
  const keyModel = store.state.dictionary.taxFileKeys;
  let obj = {};
  Object.keys(keyModel).map((key) => {
    const itemVal = item[key] || '';
    if (key === 'taxCountyAndNos') {
      obj[key] = itemVal.split(',')[0];
    } else {
      obj[key] = itemVal;
    }
  });
  if (type === 'tbr') {
    setMessage('tbTaxFile', obj);
  } else {
    setMessage('bbTaxFile', obj);
  }
}
